<template>
	<view>
		<view class="bg-white padding">
			<view class="cu-steps">
				<view class="cu-item" :class="index>num?'':'text-blue'" v-for="(item,index) in numList" :key="index">
					<text class="num" :class="index==2?'err':''" :data-index="index + 1"></text> {{item.name}}
				</view>
			</view>
		</view>
		<view class="title">
			<view class="line"></view>
			<view>上传入场照片</view>
		</view>
		<view class="sc">
			<image src="../../static/5.png" mode=""></image>
		</view>
		<view class="ts">请上传入场环境照片</view>
		<view class="sc">
			<image src="../../static/5.png" mode=""></image>
		</view>
		<view class="ts">请上传入场车身照片（必须显示车牌号码）</view>
		<view class="title">
			<view class="line"></view>
			<view>交接人员</view>
		</view>
		<view class="foot_box">
			<view>班组对接人员：</view>
			<view>
				<picker @change="bindPickerChange" :value="index" :range="array">
					<view class="uni-input">{{array[index]}}</view>
				</picker>
			</view>
		</view>
		<view class="foot_box">
			<view>班组对接人员：</view>
			<view>
				<picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindDateChange">
					<view class="uni-input">{{date}}</view>
				</picker>
			</view>
		</view>
		<view class="foot_btn">确认车辆进站</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			const currentDate = this.getDate({
				format: true
			})
			return {
				array: ['中国', '美国', '巴西', '日本'],
				index: 0,
				date: currentDate,
				numList: [{
					name: '订单确认'
				}, {
					name: '到场确认'
				}, {
					name: '维修确认'
				}, {
					name: '进站确认'
				}, {
					name: '救援结束'
				},],
				num: 0,
			}
		},
		computed: {
		        startDate() {
		            return this.getDate('start');
		        },
		        endDate() {
		            return this.getDate('end');
		        }
		},
		methods: {
			bindPickerChange: function(e) {
				console.log('picker发送选择改变，携带值为', e.target.value)
				this.index = e.target.value
			},
			bindDateChange: function(e) {
				this.date = e.target.value
			},
			getDate(type) {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();
	
				if (type === 'start') {
					year = year - 60;
				} else if (type === 'end') {
					year = year + 2;
				}
				month = month > 9 ? month : '0' + month;;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			}
		}
	}
</script>

<style>
	.foot_btn{
		width: calc(100% - 100rpx);
		height: 80rpx;
		margin: 80rpx auto;
		color: rgba(245, 245, 245, 1);
		font-size: 32rpx;
		font-family: Arial;
		display: flex;
		justify-content: center;
		align-items: center;
		border-radius: 12rpx;
		background-color: rgba(2, 128, 255, 1);
		box-shadow: 0rpx 4rpx 12rpx 0rpx rgba(2, 128, 255, 1);
		border: 2rpx solid rgba(255, 255, 255, 0);
	}
	.foot_box{
		padding: 20rpx 70rpx;
		box-sizing: border-box;
		display: flex;
		justify-content: flex-start;
		align-items: center;
	}
	.ts{
		margin: 26rpx 0;
		color: rgba(102, 102, 102, 1);
		font-size: 12rpx;
		text-align: center;
		font-family: Arial;
	}
	.sc>image{
		width: 100rpx;
		height: 100rpx;
	}
	.sc{
		width: calc(100% - 100rpx);
		height: 300rpx;
		margin: 0 auto;
		margin-top: 40rpx;
		border-radius: 10rpx;
		border: 4rpx solid #8a8a8a;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.line{
		width: 0;
		height: 28rpx;
		border: 3rpx solid rgba(0, 138, 245, 1);
		margin: 0 40rpx 0rpx 50rpx;
	}
	.title{
		display: flex;
		justify-content: flex-start;
		align-items: center;
	}
	page{
		background-color: #FFFFFF;
	}
</style>
